package org.jwcloud.project.module.zx.txzldp.controller;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import org.jwcloud.project.module.zx.baseManager.service.repository.MatBaseManagerRepository;
import org.jwcloud.project.module.zx.common.FmtUtil;
import org.jwcloud.project.module.zx.common.Resp;
import org.jwcloud.project.module.zx.common.repository.RptCommonRepository;
import org.jwcloud.project.module.zx.common.service.RptUtService;
import org.jwcloud.project.module.zx.txzldp.service.repository.TxzldpCommonViewRepository;
import org.jwcloud.project.module.zx.workTime.service.repository.MatWorkTimeRepository;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import com.github.pagehelper.PageHelper;
import com.jw.mid.mm.comm.common.controller.BaseController;
import com.jw.mid.mm.comm.common.controller.CrudController;
import com.jw.mid.mm.comm.common.json.Response;
import com.jw.mid.mm.comm.common.pagination.ListBounds;
import com.jw.mid.mm.comm.common.pagination.ListSlice;
import com.jw.mid.mm.comm.common.pagination.PageListSlice;
import com.jw.mid.mm.comm.common.pagination.Pagination;
import com.jw.mid.mm.comm.common.service.CrudService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@Api(value = "API - Controlle",
description = "铁西监督展示平台-新", tags = "jdNew")
@RestController
@Transactional
@RequestMapping("/rest/txzldp/jdV2")
public class TxzldpJdV2Controller extends BaseController{
	
	@Autowired
    private SqlSessionTemplate sqlSessionTemplate;
	
	@Autowired
    public RptUtService rptUtService;
	
	
	@GetMapping("testSum")
    @ApiOperation(value = "测试", notes = "")
    @ApiImplicitParams({
    })
    public Resp testSum(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.jdV2.testSum", param));
    }
	
	@GetMapping("testList")
    @ApiOperation(value = "测试", notes = "")
    @ApiImplicitParams({
    })
    public Resp testList(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.jdV2.testList", param));
    }
	
	//首页
	@GetMapping("shouye_zjxx")
    @ApiOperation(value = "首页-资金信息", notes = "")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "year_id", value = "年", required = true, dataType = "string", paramType = "query"),
    })
    public Resp shouye_zjxx(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.jdV2.shouye_zjxx", param));
    }
	
	@GetMapping("shouye_xmxx")
    @ApiOperation(value = "首页-项目信息", notes = "")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "year_id", value = "年", required = true, dataType = "string", paramType = "query"),
    })
    public Resp shouye_xmxx(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.jdV2.shouye_xmxx", param));
    }
	
	@GetMapping("shouye_szyd")
    @ApiOperation(value = "首页-三重一大", notes = "")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "year_id", value = "年", required = true, dataType = "string", paramType = "query"),
    })
    public Resp shouye_szyd(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.jdV2.shouye_szyd", param));
    }
	
	@GetMapping("shouye_wtxx")
    @ApiOperation(value = "首页-问题信息", notes = "")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "year_id", value = "年", required = true, dataType = "string", paramType = "query"),
    })
    public Resp shouye_wtxx(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.jdV2.shouye_wtxx", param));
    }
	
	@GetMapping("shouye_sjfx")
    @ApiOperation(value = "首页-数据分析", notes = "")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "year_id", value = "年", required = true, dataType = "string", paramType = "query"),
    })
    public Resp shouye_sjfx(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.jdV2.shouye_sjfx", param));
    }
	
	
	//问题
	@GetMapping("wenti_wtsjzb")
    @ApiOperation(value = "首页-问题数据及占比", notes = "")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "year_id", value = "年", required = true, dataType = "string", paramType = "query"),
    })
    public Resp wenti_wtsjzb(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.jdV2.wenti_wtsjzb", param));
    }
	
	@GetMapping("wenti_ajsl")
    @ApiOperation(value = "首页-案件数量", notes = "")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "year_id", value = "年", required = true, dataType = "string", paramType = "query"),
    })
    public Resp wenti_ajsl(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.jdV2.wenti_ajsl", param));
    }
	
	@GetMapping("wenti_zxjdwt")
    @ApiOperation(value = "首页-各类专项监督问题占比图", notes = "")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "year_id", value = "年", required = true, dataType = "string", paramType = "query"),
    })
    public Resp wenti_zxjdwt(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.jdV2.wenti_zxjdwt", param));
    }
	
	@GetMapping("wenti_zxwtzj")
    @ApiOperation(value = "首页-各类专项问题资金占比图", notes = "")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "year_id", value = "年", required = true, dataType = "string", paramType = "query"),
    })
    public Resp wenti_zxwtzj(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.jdV2.wenti_zxwtzj", param));
    }
	
	@GetMapping("wenti_jljdwt")
    @ApiOperation(value = "首页-各类纪律监督问题占比图", notes = "")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "year_id", value = "年", required = true, dataType = "string", paramType = "query"),
    })
    public Resp wenti_jljdwt(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.jdV2.wenti_jljdwt", param));
    }
	
	@GetMapping("wenti_jlwtzj")
    @ApiOperation(value = "首页-各类纪律问题资金占比图", notes = "")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "year_id", value = "年", required = true, dataType = "string", paramType = "query"),
    })
    public Resp wenti_jlwtzj(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.jdV2.wenti_jlwtzj", param));
    }
	
	@GetMapping("wenti_ajczrs")
    @ApiOperation(value = "首页-案件处置人数占比图", notes = "")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "year_id", value = "年", required = true, dataType = "string", paramType = "query"),
    })
    public Resp wenti_ajczrs(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.jdV2.wenti_ajczrs", param));
    }
	
	@GetMapping("wenti_ajxt")
    @ApiOperation(value = "首页-案件形态占比图", notes = "")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "year_id", value = "年", required = true, dataType = "string", paramType = "query"),
    })
    public Resp wenti_ajxt(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.jdV2.wenti_ajxt", param));
    }
	
	//三重一大
	@GetMapping("szyd_szydsj")
    @ApiOperation(value = "首页-三重一大数据", notes = "")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "year_id", value = "年", required = true, dataType = "string", paramType = "query"),
    })
    public Resp szyd_szydsj(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.jdV2.szyd_szydsj", param));
    }
	
	@GetMapping("szyd_rm")
    @ApiOperation(value = "首页-任免季度数量饼图", notes = "")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "year_id", value = "年", required = true, dataType = "string", paramType = "query"),
    })
    public Resp szyd_rm(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.jdV2.szyd_rm", param));
    }
	
	@GetMapping("szyd_jc")
    @ApiOperation(value = "首页-决策季度数量饼图", notes = "")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "year_id", value = "年", required = true, dataType = "string", paramType = "query"),
    })
    public Resp szyd_jc(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.jdV2.szyd_jc", param));
    }
	
	@GetMapping("szyd_bgfzj")
    @ApiOperation(value = "首页-办公费资金top5", notes = "")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "year_id", value = "年", required = true, dataType = "string", paramType = "query"),
    })
    public Resp szyd_bgfzj(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.jdV2.szyd_bgfzj", param));
    }
	
	//资金信息
	@GetMapping("zj_bt")
    @ApiOperation(value = "首页-补贴类资金top5", notes = "")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "year_id", value = "年", required = true, dataType = "string", paramType = "query"),
    })
    public Resp zj_bt(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.jdV2.zj_bt", param));
    }
	
	@GetMapping("zj_hwjfw")
    @ApiOperation(value = "首页-货物及服务类资金top5", notes = "")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "year_id", value = "年", required = true, dataType = "string", paramType = "query"),
    })
    public Resp zj_hwjfw(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.jdV2.zj_hwjfw", param));
    }
	
	@GetMapping("zj_cscw")
    @ApiOperation(value = "首页-村社村务类资金top5", notes = "")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "year_id", value = "年", required = true, dataType = "string", paramType = "query"),
    })
    public Resp zj_cscw(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.jdV2.zj_cscw", param));
    }
	
	@GetMapping("zj_bgf")
    @ApiOperation(value = "首页-办公费相关资金top5", notes = "")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "year_id", value = "年", required = true, dataType = "string", paramType = "query"),
    })
    public Resp zj_bgf(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.jdV2.zj_bgf", param));
    }
	
	@GetMapping("zj_glzjze")
    @ApiOperation(value = "首页-各类资金总额", notes = "")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "year_id", value = "年", required = true, dataType = "string", paramType = "query"),
    })
    public Resp zj_glzjze(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.jdV2.zj_glzjze", param));
    }
	
	@GetMapping("zj_glzjzs")
    @ApiOperation(value = "首页-各类资金走势", notes = "")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "year_id", value = "年", required = true, dataType = "string", paramType = "query"),
    })
    public Resp zj_glzjzs(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.jdV2.zj_glzjzs", param));
    }
	
	//项目信息
	@GetMapping("xmxx_xmsl")
    @ApiOperation(value = "首页-项目数量", notes = "")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "year_id", value = "年", required = true, dataType = "string", paramType = "query"),
    })
    public Resp xmxx_xmsl(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.jdV2.xmxx_xmsl", param));
    }
	
	@GetMapping("xmxx_xmsl_top")
    @ApiOperation(value = "首页-项目数量前五单位", notes = "")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "year_id", value = "年", required = true, dataType = "string", paramType = "query"),
    })
    public Resp xmxx_xmsl_top(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.jdV2.xmxx_xmsl_top", param));
    }
	
	@GetMapping("xmxx_xmje")
    @ApiOperation(value = "首页-项目金额", notes = "")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "year_id", value = "年", required = true, dataType = "string", paramType = "query"),
    })
    public Resp xmxx_xmje(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.jdV2.xmxx_xmje", param));
    }
	
	@GetMapping("xmxx_xmje_top")
    @ApiOperation(value = "首页-项目金额前五单位", notes = "")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "year_id", value = "年", required = true, dataType = "string", paramType = "query"),
    })
    public Resp xmxx_xmje_top(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.jdV2.xmxx_xmje_top", param));
    }
	
	@GetMapping("xmxx_xmjebg")
    @ApiOperation(value = "首页-项目金额变更", notes = "")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "year_id", value = "年", required = true, dataType = "string", paramType = "query"),
    })
    public Resp xmxx_xmjebg(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.jdV2.xmxx_xmjebg", param));
    }
	
	@GetMapping("xmxx_xmjebg_detail_top")
    @ApiOperation(value = "首页-项目金额变更明细-top5", notes = "")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "year_id", value = "年", required = true, dataType = "string", paramType = "query"),
    })
    public Resp xmxx_xmjebg_detail_top(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.sqlSessionTemplate.selectList("txzldp.jdV2.xmxx_xmjebg_detail_top", param));
    }
	
}